Shader "Custom/FightLevelControl" {
	Properties {
		_MainTex ("Base (RGB)", 2D) = "white" {}
		_LevelRate ("Level",range(0,1)) = 0
		_PI("PI",range(0,4)) = 0
	}
	SubShader {
		Tags { "RenderType"="TransparentCutout" "Queue" = "Transparent"}
		LOD 200
		
		Pass
		{
			Lighting Off
			Blend SrcAlpha OneMinusSrcAlpha
			
			CGPROGRAM
			#pragma vertex vert
			#pragma fragment frag
			#include "UnityCG.cginc"
			
			sampler2D _MainTex;
			float _LevelRate;
			float _PI;
			
			struct appdata_t
			{
				float4 vertex : POSITION;
				float2 texcoord : TEXCOORD0;
			};
			
			struct v2f
			{
				float4 vertex : POSITION;
				float2 uv : TEXCOORD0;
			};
			
			v2f vert (appdata_t v)
			{
				v2f o;
				o.vertex = mul(UNITY_MATRIX_MVP, v.vertex);
				o.uv = v.texcoord;
				return o;
			}
			
			half4 frag (v2f IN) : COLOR
			{
				float2 uv = IN.uv;
				half4 col;
				//Add an effect of water
				if(uv.y > _LevelRate + cos(uv.x * _PI * 10 + _Time.w * 5) * 0.02 ){
					col = tex2D(_MainTex, uv);
				} else {
					col = half4(0,0,0,0);
				}
				
				return col;
			}
			ENDCG
		}
	} 
}
